package cin.ufpe.br.GDI.Testes;

import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;
import javax.swing.JPanel;

public class JImagePanel extends JPanel {

	private BufferedImage img;


	public JImagePanel(BufferedImage img)
	{
		this.img = img;		
	}
	
	public JImagePanel(File file) throws IOException
	{
		this.img = ImageIO.read(file);
	}
	
	public JImagePanel(String file) throws IOException
	{
		this(new File(file));
	}

	public void paintComponent(Graphics c)
	{
		c.drawImage(this.img, 0, 0, null);
	}

	public BufferedImage getImg() {
		return img;
	}

	public void setImg(BufferedImage img) {
		this.img = img;
	}
	
	
	

}
